#include <time.h>
#include<bits/stdc++.h>
using namespace std;

#define ll long long 
#define ull unsigned long long
const ll MAXN = 100000000;

ll arr1[MAXN];
ll arr2[MAXN];

ll cal(ll n){
    return (MAXN*8)*1000/n;
}

void init(){
    srand(time(0));
    
    for(ll i=0;i<MAXN;++i)
        arr1[i] = rand()*rand();

}

void rand_cpy_test(){
    clock_t start,ends;
    start=clock();

    ull idx;
    for(ll i=0;i<MAXN;++i){
        idx = i*i*i;
        idx %= MAXN;
        arr2[idx] = arr1[idx];
    }

    ends=clock();
    cout<<"rand: "<<cal(ends-start)<<endl;
}

void seq_cpy_test(){
    clock_t start,ends;
    start=clock();

    ull kk,idx;
    for(ll i=0;i<MAXN;++i){
        kk = i*i*i;
        idx = i;
        idx %= MAXN;
        arr2[idx] = arr1[idx];
    }

    ends=clock();
    cout<<"seq: "<<cal(ends-start)<<endl;
}
void mem_cpy_test(){
        clock_t start,ends;
    start=clock();

    memcpy(arr2,arr1,MAXN*8);

    ends=clock();
    cout<<"mem: "<<cal(ends-start)<<endl;
}

int main(){

    init();
    rand_cpy_test();
    seq_cpy_test();
    mem_cpy_test();
    // for(int i=0;i<MAXN;++i){
    //     if(arr1[i]!=arr2[i])cout<<"error"<<endl;
    // }
    return 0;
}